% title = 'Your Pastes'
% scripts = tuple(('sorttable.js',))
% include(top)
% import time as t
% import datetime as dt
<!-- TODO: Make this page responsive for mobile -->
<div class="pure-g">
	<div class="pure-u-1 pure-u-md-1-4"></div>
	<div class="pure-u-1 pure-u-md-1-2">
		<h1 class="center">{{title}}</h1>
	</div>
	<div class="pure-u-1 pure-u-md-1-4"></div>
	<div class="pure-u-1 content">
% if len(pastes):
	<table class="pure-table sortable">
		<thead>
		<tr><th>Key</th>
% if defined('admin_view'):
<th>User</th>\\
% end
<th>Title</th><th>Views</th><th>Filename</th><th>Filetype</th><th>Uploaded</th><th>Expires</th><th>Delete</th></tr>
		</thead>
		<tbody>
% for paste, contents in pastes.items():
			<tr>
				<td><a href="/p/{{paste}}">{{paste}}</a></td>
% if defined('admin_view'):
				<td>{{contents['user']}}</td>
% end
				<td>{{contents['title']}}</td>
				<td>{{contents['views']}}</td>
				<td>{{contents['filename']}}</td>
				<td>{{contents['filetype']}}</td>
% u_time = dt.datetime.fromtimestamp(0) + dt.timedelta(seconds=int(contents['time']))
				<td sorttable_customkey="{{contents['time']}}">{{!u_time.strftime("%B %d, %Y at %I:%M %p")}}</td>
% expires = int(contents['expires'])
% if expires:
%     date = dt.datetime.fromtimestamp(0) + dt.timedelta(seconds=int(expires))
%     #date = dt.datetime.fromtimestamp(int(expires))
				<td sorttable_customkey="{{expires}}">{{!date.strftime("%B %d, %Y at %I:%M %p")}}</td>
% else:
				<td sorttable_customkey="{{expires}}">Never</td>
% end  # (if)
				<td><a href="/delete/{{paste}}">Delete</a></td>
			</tr>
% end  # (for)
		</tbody>
	</table>
	
% else:
		<p>You have no pastes. Want to <a href="/upload">upload one?</a></p>
% end  # (if)
	
	</div>
</div>

% include(bottom)
